//
//  Mehfile_ZainabViewController.m
//  Mehfile Zainab
//
//  Created by Sitara Badourali on 18/01/12.
//  Copyright 2012 CFA de Bobigny - COIFFURE. All rights reserved.
//

#define MZ_INFOS_VC_TITLE @"Infos"
#define MZ_CONTACTS_VC_TITLE @"Contacts"
#define MZ_GALLERY_VC_TITLE @"Albums"
#define MZ_PROGRAMS_VC_TITLE @"Programme"
#define MZ_NEWS_VC_TITLE @"News"
#define MZ_TIMETABLE_VC_TITLE @"Horaires Namaz"
#define MZ_MENU_BACK_BUTTON_TITLE @"Menu"

#import "Mehfile_ZainabViewController.h"
#import "MZInfosViewController.h"
#import "MZContactsViewController.h"
#import "MZGalleryViewController.h"
#import "MZProgramViewController.h"
#import "MZNewsViewController.h"
//#import "MZTimeTableViewController.h"
#import "MZTimeTableSegmentedViewController.h"
//#import "MZVideo.h"

@implementation Mehfile_ZainabViewController

/*
-(IBAction)playMovie:(id)sender
{
	UIButton *playButton = (UIButton *) sender; 

	MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[[[MZVideo alloc] init] getDefaultVideoURL]];
	
    [[NSNotificationCenter defaultCenter] addObserver:				self
														selector:	@selector(moviePlaybackComplete:)
														name:		MPMoviePlayerPlaybackDidFinishNotification
														object:		moviePlayerController];
	
	[moviePlayerController.view setFrame:CGRectMake(	playButton.frame.origin.x, 
														playButton.frame.origin.y, 
														playButton.frame.size.width, 
														playButton.frame.size.height)];
    
	[self.view addSubview:moviePlayerController.view];
	
    [moviePlayerController play];
	
}

- (void)moviePlaybackComplete:(NSNotification *)notification
{
    MPMoviePlayerController *moviePlayerController = [notification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self
													name:MPMoviePlayerPlaybackDidFinishNotification
												  object:moviePlayerController];
	
    [moviePlayerController.view removeFromSuperview];
    [moviePlayerController release];
}
*/

-(void)displayInfos {
	
	NSLog(@"Display Mehfile Zainab Infos from 2");
	
	MZInfosViewController *mzInfosViewController = [[MZInfosViewController alloc] initWithNibName:@"MZInfosViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzInfosViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzInfosViewController.title = MZ_INFOS_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzInfosViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
    */
    
    mzInfosViewController.title = MZ_INFOS_VC_TITLE;
    
    [self.navigationController pushViewController:mzInfosViewController animated:YES];
    
	//[navController release];
	[mzInfosViewController release];
	
	return;
	
}

-(void)displayContacts {
	
	NSLog(@"Display Mehfile Zainab Contacts");
	
	MZContactsViewController *mzContactsViewController = [[MZContactsViewController alloc] initWithNibName:@"MZContactsViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzContactsViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzContactsViewController.title = MZ_CONTACTS_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzContactsViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
    */
    
    mzContactsViewController.title = MZ_CONTACTS_VC_TITLE;
    
    [self.navigationController pushViewController:mzContactsViewController animated:YES];
    
	[mzContactsViewController release];
	
	return;
	
}

-(void)displayGallery {
	
	NSLog(@"Display Mehfile Zainab Gallery");
	
	MZGalleryViewController *mzGalleryViewController = [[MZGalleryViewController alloc] initWithNibName:@"MZGalleryViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzGalleryViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzGalleryViewController.title = MZ_GALLERY_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzGalleryViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
    */
    
    mzGalleryViewController.title = MZ_GALLERY_VC_TITLE;
    
    [self.navigationController pushViewController:mzGalleryViewController animated:YES];
    
	[mzGalleryViewController release];
	
	return;
	
}

-(void)displayProgram {
	
	NSLog(@"Display Mehfile Zainab Program");
	
	MZProgramViewController *mzProgramViewController = [[MZProgramViewController alloc] initWithNibName:@"MZProgramViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzProgramViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzProgramViewController.title = MZ_PROGRAMS_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzProgramViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
    */
    
    mzProgramViewController.title = MZ_PROGRAMS_VC_TITLE;
    
    [self.navigationController pushViewController:mzProgramViewController animated:YES];
    
	[mzProgramViewController release];
	
	return;
	
}

-(void)displayNews {
	
	NSLog(@"Display Mehfile Zainab News");
	
	MZNewsViewController *mzNewsViewController = [[MZNewsViewController alloc] initWithNibName:@"MZNewsViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzNewsViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzNewsViewController.title = MZ_NEWS_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzNewsViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
    */
    
    mzNewsViewController.title = MZ_NEWS_VC_TITLE;
    
    [self.navigationController pushViewController:mzNewsViewController animated:YES];
    
	[mzNewsViewController release];
	
	return;
	
}

-(void)displayTimeTable {
	
	NSLog(@"Display Mehfile Zainab Time Table");
	
    /*
	MZTimeTableViewController *mzTimeTableViewController = [[MZTimeTableViewController alloc] initWithNibName:@"MZTimeTableViewController" bundle:nil];
	
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzTimeTableViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzTimeTableViewController.title = MZ_TIMETABLE_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzTimeTableViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
	[mzTimeTableViewController release];
	*/
    
    MZTimeTableSegmentedViewController *mzTimeTableViewController = [[MZTimeTableSegmentedViewController alloc] initWithNibName:@"MZTimeTableSegmentedViewController" bundle:nil];
	
    /*
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:mzTimeTableViewController];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	mzTimeTableViewController.title = MZ_TIMETABLE_VC_TITLE;
	UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] 
									  initWithTitle:MZ_MENU_BACK_BUTTON_TITLE
									  style:UIBarButtonItemStyleBordered 
									  target:self
									  action:@selector(GoBack:)];
	mzTimeTableViewController.navigationItem.leftBarButtonItem = barButtonItem;	
	[self presentModalViewController:navController animated:YES];
	
	[navController release];
    */
    
    mzTimeTableViewController.title = MZ_TIMETABLE_VC_TITLE;
    
    [self.navigationController pushViewController:mzTimeTableViewController animated:YES];
    
	[mzTimeTableViewController release];
    
	return;
	
}

/*
-(IBAction)GoBack:(id)sender
{
	[self dismissModalViewControllerAnimated:YES];
}
*/

- (IBAction)mainIconSelected:(id)sender {
    
	NSLog(@"Icon tapped in main screen, tag selected  : %d",[sender tag]);
	
	switch ([sender tag] ) {
		case 1:
			[self displayProgram];
			break;
		case 2:
			[self displayGallery];
			break;
		case 3:
			[self displayTimeTable];
			break;
		case 4:
			[self displayNews];
			break;
		case 5:
			[self displayContacts];
			break;
		case 6:
			[self displayInfos];
			break;
		default:
			break;
	}
	
}

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"View did load for Mehfile_ZainabViewController");
}



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end
